<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改广告位详情')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ad_material-edit" th:object="${iiAdMaterial}">
            <input name="id" th:field="*{id}" type="hidden">
            <input name="adId" th:field="*{adId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">素材：</label>
                <div class="col-sm-8">
                    <!--<input name="materialId" th:field="*{materialId}" class="form-control" type="text" required>-->
                    <div class="input-group">
                        <input id="materialId" name="materialId" class="form-control" required type="hidden" th:field="*{materialId}">
                        <input id="materialName" class="form-control valid" type="text" onclick="selectImage()" th:field="*{materialName}" required readonly="true"  aria-invalid="false">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">链接：</label>
                <div class="col-sm-8">
                    <input name="link" th:field="*{link}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">排序：</label>
                <div class="col-sm-8">
                    <input name="sort" th:field="*{sort}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('lk_ii_status')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}" required>
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "ii/ad_material";
        $("#form-ad_material-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-ad_material-edit').serialize());
            }
        }

        function selectImage() {
            var url=ctx + "ii/material/image_selector";
            $.modal.open("素材选择",url);
        }
    </script>
</body>
</html>